package cn.doitedu.day08

case class Teacher(name: String, age: Int, fv: Double) extends Ordered[Teacher] {

  override def compare(that: Teacher): Int = {

    //如果颜值相等，按照年龄升序
    if(fv == that.fv) {
      age - that.age
    } else {
      //颜值不等，按照颜值的降序
      java.lang.Double.compare(that.fv, fv)
    }
  }
}
